package com.hdoit.apollo.web.version.apis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hdoit.apollo.logical.version.model.AndroidVersion;
import com.hdoit.apollo.logical.version.service.IAndroidVersionService;
import com.tennetcn.authority.component.webapi.BaseApi;
import com.tennetcn.authority.component.webapi.ResponseModel;
import com.wordnik.swagger.annotations.ApiOperation;

import io.swagger.annotations.Api;

@Controller
@RequestMapping(value = "/api/v1/version/androidVersion/",method = { RequestMethod.GET,RequestMethod.POST},produces = "application/json;charset=UTF-8")
@CrossOrigin(origins = "*", maxAge = 3600)
@Api(value="/api/v1/version/androidVersion")
public class AndroidVersionApi extends BaseApi{
	
	@Autowired
	private IAndroidVersionService androidVersionService;
	
	private final String getNewVersion="getNewVersion";
	
    @RequestMapping(value = getNewVersion)
    @ApiOperation(notes = getNewVersion, httpMethod = "get", value = "获取安卓新版本信息")
    public @ResponseBody String getNewVersion(){
    	ResponseModel rm=new ResponseModel();
    	AndroidVersion androidVersion = androidVersionService.getNewVersion();
    	rm.put("androidVersion",androidVersion);
    	return rm.toJson();
    }
}
